package com.teacher.pc.controller;


import com.teacher.common.CommonResult;
import com.teacher.pojo.dto.certificatetask.CertificateTaskAddDto;
import com.teacher.pojo.dto.certificatetask.CertificateTaskUpdateDto;
import com.teacher.pojo.dto.moraleducation.MoralEducationAddDto;
import com.teacher.pojo.dto.moraleducation.MoralEducationUpdateDto;
import com.teacher.pojo.vo.certificatetask.CertificateTaskGetVo;
import com.teacher.pojo.vo.moraleducation.MoralEducationGetVo;
import com.teacher.service.ICertificateTaskService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 证书申请 前端控制器
 * </p>
 *
 * @author zfm
 * @since 2021-08-13
 */
@RestController
@RequestMapping("/pc/certificate-task")
public class CertificateTaskController {

    @Autowired
    private ICertificateTaskService iCertificateTaskService;

    /**
     * 发起证书申请审批流程
     *
     * @param dto
     * @return
     */
    @PostMapping
    @ApiOperation("发起证书申请审批流程 永久加分证书类型 10-> 英语等级证书 20->普通话证书 30->计算机证书 40->教师资格证书")
    public CommonResult<String> add(@RequestBody CertificateTaskAddDto dto) {
        return iCertificateTaskService.add(dto);
    }

    /**
     * 更新流程
     *
     * @param dto
     * @return
     */
    @PutMapping
    @ApiOperation("更新流程")
    public CommonResult<String> update(@RequestBody CertificateTaskUpdateDto dto) {
        return iCertificateTaskService.updateInfo(dto);
    }

    /**
     * 获取详情
     *
     * @return
     */
    @GetMapping("/{flowId}")
    @ApiOperation("获取详情")
    public CommonResult<CertificateTaskGetVo> getDetails(@PathVariable("flowId") Long id) {
        return iCertificateTaskService.getDetails(id);
    }
    
}

